<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Free Order</title>
	<script type="text/javascript" src="scripts/global.js"></script>
	<script type="text/javascript">
	/** 用户登录 **/
	function doLogin()
	{
		var password = /^([0-9]|[a-z]|[A-Z]){3,20}$/;
		
		if(trim(document.getElementById("loginID").value) == "")
		{
			alert("请输入用户名！");
			return false;
		}
		
		if(trim(document.getElementById("loginPW").value) == "")
		{
			alert("请输入密码！");
			return false;
		}
		
		if(!password.test(document.getElementById("loginPW").value))
		{
			alert("密码：格式错误，合法格式：6-20位数字或字母！");
			return false;
		}
		
		return true;
	}
	</script>
	<script type="text/javascript">
	/** 用户注册 **/
	function doRegister()
	{
		document.login_form.action = "login!doRegister.action";
		document.login_form.submit();
	}
	</script>
  </head>
  
  <body>
    <form id="login_form" name="login_form" action="login!doLogin.action" method="POST" onsubmit="return doLogin()">
	    <table>
			<tr>
				<td>
					User:
				</td>
				<td>
					<input type='text' name='loginID'>
				</td>
			</tr>
			<tr>
				<td>
					Password:
				</td>
				<td>
					<input type='password' name='loginPW'>
				</td>
			</tr>
			<tr>
				<td colspan='2'>
					<input name="loginBtn" type="submit" value="登陆">
					<input type="button" name="registerBtn" value="注册" tabindex="4" class="input_submit" onClick="doRegister()">
				</td>
			</tr>
			<tr>
				<td>
					<font color="#FF0000"><s:property value="error"/></font>
				</td>
			</tr>
		</table>
		<div>   
          <s:a href="user!list.action">查看用户列表</s:a>   
       	</div> 
    </form>
  </body>
</html>
